package com.slz3.business.module.systemManagement.sysRolePermissions.service;

import com.slz3.business.frame.module.Repositorys;
import com.slz3.business.module.systemManagement.sysRolePermissions.domain.SysRolePermissions;
import com.slz3.business.module.systemManagement.sysRolePermissions.domain.SysRolePermissionsFactory;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import java.time.LocalDateTime;
import java.util.List;

@Slf4j
@Service
public class SysRolePermissionsTransactionalServiceImpl implements SysRolePermissionsTransactionalService {

    @Override
    public SysRolePermissions modify(SysRolePermissions sysRolePermissionsNew) {
        Repositorys.sysRolePermissions.test();
        Repositorys.sysRolePermissions.save(SysRolePermissionsFactory.initBaseFields());
        System.err.println(1/0);
        sysRolePermissionsNew.setLastModifyTime(LocalDateTime.now());
        return Repositorys.sysRolePermissions.saveAndFlush(sysRolePermissionsNew);
    }

    @Override
    public List<SysRolePermissions> batchModify(List<SysRolePermissions> sysRolePermissionsList) {
        return Repositorys.sysRolePermissions.saveAll(sysRolePermissionsList);
    }
}
